var tagService = require('../service/tagService')

module.exports = {
    async login(req, res) {
        var result = await tagService.login(req.body)
        if (result) {
            let { _id, tagname, role } = result
            res.send({
                status: "success",
                data: { _id, tagname, role }
            })
        } else {
            res.send({
                status: "error",
            })
        }
    },
    async add(req, res) {
        var result = await tagService.add(req.body)
        res.send(result)
    },
    async getList(req, res) {
        var result = await tagService.getList()
        res.send(result)
    },
    async update(req, res) {
        var result = await tagService.update(req.params.id, req.body)
        res.send(result)
    },
    async delete(req, res) {
        var result = await tagService.delete(req.body)
        res.send(result)
    }
}